class_name PowUtils

const POWS: Dictionary = {
	2:
	{
		0: 1,
		1: 2,
		2: 4,
		3: 8,
		4: 16,
		5: 32,
		6: 64,
		7: 128,
		8: 256,
		9: 512,
		10: 1024,
		11: 2048,
		12: 4096,
		13: 8192,
		14: 16384,
		15: 32768,
		16: 65536,
		17: 131072,
		18: 262144
	},
	3:
	{
		0: 1,
		1: 3,
		2: 9,
		3: 27,
		4: 81,
		5: 243,
		6: 729,
		7: 2187,
		8: 6561,
		9: 19683,
		10: 59049,
		11: 177147,
		12: 531441,
		13: 1594323,
		14: 4782969,
		15: 14348907,
		16: 43046721,
		17: 129140163,
		18: 387420489
	},
	4:
	{
		0: 1,
		1: 4,
		2: 16,
		3: 64,
		4: 256,
		5: 1024,
		6: 4096,
		7: 16384,
		8: 65536,
		9: 262144,
		10: 1048576,
		11: 4194304,
		12: 16777216,
		13: 67108864,
		14: 268435456,
		15: 1073741824,
		16: 4294967296,
		17: 17179869184,
		18: 68719476736
	},
	5:
	{
		0: 1,
		1: 5,
		2: 25,
		3: 125,
		4: 625,
		5: 3125,
		6: 15625,
		7: 78125,
		8: 390625,
		9: 1953125,
		10: 9765625,
		11: 48828125,
		12: 244140625,
		13: 1220703125,
		14: 6103515625,
		15: 30517578125,
		16: 152587890625,
		17: 762939453125,
		18: 3814697265625
	},
	6:
	{
		0: 1,
		1: 6,
		2: 36,
		3: 216,
		4: 1296,
		5: 7776,
		6: 46656,
		7: 279936,
		8: 1679616,
		9: 10077696,
		10: 60466176,
		11: 362797056,
		12: 2176782336,
		13: 13060694016,
		14: 78364164096,
		15: 470184984576,
		16: 2821109907456,
		17: 16926659444736,
		18: 101559956668416
	},
	7:
	{
		0: 1,
		1: 7,
		2: 49,
		3: 343,
		4: 2401,
		5: 16807,
		6: 117649,
		7: 823543,
		8: 5764801,
		9: 40353607,
		10: 282475249,
		11: 1977326743,
		12: 13841287201,
		13: 96889010407,
		14: 678223072849,
		15: 4747561509943,
		16: 33232930569601,
		17: 232630513987207,
		18: 1628413597910449
	},
	8:
	{
		0: 1,
		1: 8,
		2: 64,
		3: 512,
		4: 4096,
		5: 32768,
		6: 262144,
		7: 2097152,
		8: 16777216,
		9: 134217728,
		10: 1073741824,
		11: 8589934592,
		12: 68719476736,
		13: 549755813888,
		14: 4398046511104,
		15: 35184372088832,
		16: 281474976710656,
		17: 2251799813685248,
		18: 18014398509481984
	},
	9:
	{
		0: 1,
		1: 9,
		2: 81,
		3: 729,
		4: 6561,
		5: 59049,
		6: 531441,
		7: 4782969,
		8: 43046721,
		9: 387420489,
		10: 3486784401,
		11: 31381059609,
		12: 282429536481,
		13: 2541865828329,
		14: 22876792454961,
		15: 205891132094649,
		16: 1853020188851841,
		17: 16677181699666568,
		18: 150094635296999136
	},
	10:
	{
		0: 1,
		1: 10,
		2: 100,
		3: 1000,
		4: 10000,
		5: 100000,
		6: 1000000,
		7: 10000000,
		8: 100000000,
		9: 1000000000,
		10: 10000000000,
		11: 100000000000,
		12: 1000000000000,
		13: 10000000000000,
		14: 100000000000000,
		15: 1000000000000000,
		16: 10000000000000000,
		17: 100000000000000000,
		18: 1000000000000000000
	}
}


static func pow_int(base: int, exponent: int) -> int:
	if base == 0:
		return 0
	if base == 1:
		return 1
	if base > 10 or exponent > 18:
		var zero: int = 0
		return zero / zero
	return POWS[base][exponent]
